#include <fstream>
using namespace std;

#include <misc/argvutils.h>
#include <dataspace/dataspace.h>

void print_usage(char* argv0) {
  cerr << argv0 << " -- dumps dataspace file." << endl;
  cerr << "Usage: " << argv0 << " --ds-fn=<dataspace-filename>" << endl;
  exit(3);
}

int main(int argc, char** argv)
{
  try {
    DictVector<string, string> args = argv_utils::parse_to_dict(argc, argv);
    if (args.size() == 0 || args.has_key("--help")) {
      print_usage(argv[0]);
    }
    
    string ds_fn = args.get("--ds-fn");
    DataSpace ds;
    ds.load(ds_fn, false);
    ds.print(cout);
  } catch (Error& e) {
    cerr << "Caught Error: " << e.msg() << endl;
  }
}
